package <%= domainPackageName %>;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

/**
 * <%= camelCaseName(tableName,true) %> <%=tableComment %> 实体
 *
 * @author 代码生成器@zhangQ
 * @date <% formatTime() %>
 */
@Entity
@Table(name = "<%= tableName %>")
public class <%= camelCaseName(tableName,true) %> implements Serializable {

    private static final long serialVersionUID = 1L;
<% table.columns.forEach(function(item){ %>
    /**
     * <%= item.remark %>
     */
    <%_ if(item.primaryKey) { -%>
    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    <%_ } -%>
    private <%= item.type %> <%= camelCaseName(item.name) %>;
<% }); %>
<% table.columns.forEach(function(item){ -%>
    public <%= item.type %> get<%= camelCaseName(item.name,true) %>() {
        return <%= camelCaseName(item.name) %>;
    }

    public void set<%= camelCaseName(item.name,true) %>(<%= item.type %> <%= camelCaseName(item.name) %>) {
        this.<%= camelCaseName(item.name) %> = <%= camelCaseName(item.name) %>;
    }

<% }); -%>

    /**
    * 判断是否相等
    */
    @Override
    public boolean equals(Object o) {
        if (this == o) {
        return true;
        }
        if (o == null || getClass() != o.getClass()) {
        return false;
        }

        <%= camelCaseName(tableName,true) %> <%= camelCaseName(tableName) %> = (<%= camelCaseName(tableName,true) %>) o;
<% table.columns.forEach(function(item){ -%>
        if (this.<%= camelCaseName(item.name) %> != null ? !this.<%= camelCaseName(item.name) %>.equals(<%= camelCaseName(tableName) %>.<%= camelCaseName(item.name) %>) : <%= camelCaseName(tableName) %>.<%= camelCaseName(item.name) %> != null) {
            return false;
        }
<% });-%>
        return true;
    }

}